{extend name="template/base_default"}
{block name="header"}
<link rel="stylesheet" href="__CSS__/common.css">
<link rel="stylesheet" href="__CSS__/weui.min.css">
<link rel="stylesheet" href="__CSS__/index.css">
<link rel="stylesheet" href="__CSS__/weuix.min.css"/>
<script src="__JS__/zepto.min.js"></script>
<script src="__JS__/lrz.min.js"></script>
<style>

    .form-head{
        color: white;
        font-size: 16px;
        background-color: rgba(255, 255, 255, 0.2);
        border-radius: 5px;
        overflow: hidden;
    }
    body{
        background-image:url("__IMG__/bj.png");
        background-size:100%;
        background-repeat:no-repeat;
        background-size:cover;
        text-align: center;
        height: 100%;
        background-color: #010A11;
        z-index: -1000;
        background-attachment:fixed;
    }
    .body-input{
        outline: none;
        color: #dddddd;
        position: relative;
        border: solid 1px #ffffff;
        background-color: rgba(255, 255, 255, 0);
        float: left;
        margin: auto;
        font-size: 16px;
        height: 41px;
        line-height: 41px;
        border-radius: 5px;
        width: 60%;
        font-family: "Microsoft YaHei UI";
    }
    .bottom-btn{
        width:50%;
        height:100%;
        float: left;
    }
    button{
        border: none;
        color:white;
    }
    .botton1{
        background-color: #FF0000;

    }
    .botton2{
        background-color: #131a34;
        width:100%;
    }
    .input-window{
        margin-left: auto;
        margin-right: auto;
        -moz-opacity:0.3; /*Firefox私有，透明度50%*/
        opacity:0.3;/*其他，透明度50%*/
        filter:alpha(opacity=30);
        background-color: white;
        height:78px;
        width:78px;
        float: left;
        border-radius: 10px;
        margin-top: 30px;
        margin-left: 20px;
    }
    .aa{
        height:3px;
        background-color: white;
        width:40px;
        position:absolute;
        top: 30px;
        left:55px;
    }
    .bb{
        width: 100%;
        height: 100%;
        opacity: 0;
        -webkit-tap-highlight-color: rgba(0,0,0,0);
    }
    li{
        list-style:none;
    }
    .store-box{
        filter:alpha(opacity=50); /*IE滤镜，透明度50%*/
        -moz-opacity:0.5; /*Firefox私有，透明度50%*/
        opacity:0.5;/*其他，透明度50%*/
        height:90px;
        margin-top: 30px;
        width: 90%;
    }
    .store-box img {
        width:100px;
        height:100px;
        float:right;
        margin-right: 10px;
        margin-top: 10px;
    }
    .store-success{
        font-size: 18px;
        color:#545454;

        font-family: "Microsoft YaHei UI";
    }
    .store-text{
        float: left;
        margin-top: 30px;
        margin-left: 16px;
        text-align: left;

    }
    .store-detail{
        font-size: 14px;
        color:#8c8c8c;
        font-family: "Microsoft YaHei UI";
        margin-top: 12px;
    }
    .store-p{
        text-align: center;
        color:white;
        margin-top: 30px;
        font-family: "Microsoft YaHei UI";
        font-size: 18px;

    }
    .store-other {
        margin-top: 20px;
        margin-left: auto;
        margin-right: auto;
        height:80px;
        background-color: white;
        border-radius: 10px;
        width:40%;
        margin-left: 20px;
        margin-top: 20px;
        -moz-opacity:0.3; /*Firefox私有，透明度50%*/
        opacity:0.3;/*其他，透明度50%*/
        filter:alpha(opacity=30);
        float: left;
        line-height: 80px;
        text-align: center;

    }
    .store-other2 {
        margin-top: 20px;
        margin-left: auto;
        margin-right: auto;
        height:80px;
        background-color: white;
        border-radius: 10px;
        width:40%;
        margin-left: 20px;
        margin-top: 20px;
        -moz-opacity:0.3; /*Firefox私有，透明度50%*/
        opacity:0.3;/*其他，透明度50%*/
        filter:alpha(opacity=30);
        float: left;
        line-height: 80px;
        text-align: center;
    }

    .store-other-img{
        width:50px;
        float: left;
        height:50px;
        margin-top: 14px;
        margin-left: 14px;
        border-radius: 10px;
    }
    .input-window{
        margin-top: 110px;
        height: 150px;
        width:150px;
        margin-left: 110px;
        border-radius: 10px;
        background-color: white;
    }
    .input-window img{
        width:100%;
        height:100%;
    }
    form{
        text-align: center;
    }
</style>
{/block}
{block name="body"}

<form action="" method="post" style="width:95%;margin: auto">



    <input  type="hidden"  id="id"  value="{$id}" />
    <div class="form-body">
        <div class="input-window" style="background-size:cover ">
            <input class="bb headimgurl" type="file" accept="image/jpg,image/jpeg,image/png,image/gif"   />
            <input  type="hidden"  id="img"  value="" />
        </div>
        <p style="color:white;margin-top: 20px;margin-left: 150px;float: left">上传凭证</p>
    </div>



    <div style="position:fixed;bottom:0;left:0;width:100%;height:50px;">
        <!--<button id="delete" class="bottom-btn botton1" type="button">删除</button>-->
        <button id="submit" class="bottom-btn botton2" type="button">提交</button>
    </div>


</form>
<div style="width:100%;height:70px;float: left">

</div>

{/block}
{block name="footer"}
<script type="text/javascript" src="__JS__/public.js"></script>
<script>
    $(function(){

        $('.headimgurl').change(function () {
            var v_this = $(this);
            lrz(this.files[0],{width:640,fieldName:"image"}).then(function (rst) {
                var formdata = new FormData();
                v_this.parent().css("background-image","url("+rst.base64+")");//无论是否上传成功都显示
                url = "__BASE__/web.php/file/upload_picture_base64";
                formdata.append("image", rst.base64);
                $.ajax({
                    url : url,
                    type : 'post',
                    data : formdata,
                    contentType : false,
                    processData : false,
                    dataType : "json",
                    success : function(data) {
                        if (data.status == true) {
                          //  $.toast("图片上传成功");
                            v_this.next().val(data.info[0]['id']);
                        }
                    },
                    error:function(){
                        $.toast("图片上传失败");
                    }
                });
                return false;
            })
        });
    })


    $('#submit').click(function () {
//alert('xx');
        var body  ={
            id:$('#id').val(),
            img:$('#img').val()
        };
        var $this = $(this);
        $this.addClass('weui-btn_disabled').attr('disabled','disabled');
        ajax_post(getBaseUrl()+'web.php/user/protocalupload',jQuery.param(body),{
            success:function(data){
                $.toast(data.data,'success');
                $this.removeClass('weui-btn_disabled').removeAttr("disabled");
                    setTimeout(
                            function(){
                                window.location.href=getBaseUrl()+'web.php/user/protocalorder.html';
                            }
                            ,1500);
            },
            error:function(data){
               // alter('aa');
                $.toast(data.data, 'error');
                $this.removeClass('weui-btn_disabled').removeAttr("disabled");
            }
        })


    });
</script>
{/block}